package com.chinasofti.manager.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.chinasofti.dao.LeaveRepository;
import com.chinasofti.manager.service.AdminLeaveService;
import com.chinasofti.model.MyLeave;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Creator: <br>
 * Date: <br>
 * Description: <br>
 */
@Service
@Component
public class AdminLeaveServiceImpl implements AdminLeaveService{
    @Autowired
    private LeaveRepository leaveRepository;

    @Override
    public List<MyLeave> queryLeaveList() {
        List<MyLeave> leaves = leaveRepository.findAll();
        return leaves;
    }

    @Override
    public void operate(Long id, Integer result) {
        MyLeave leave = leaveRepository.findByIdEquals(id);
        leave.setState(result);
        leaveRepository.save(leave);
    }

}
